package cn.wolfcode.luowowo.acticle.domain;

import cn.wolfcode.luowowo.common.domain.BaseDomain;
import cn.wolfcode.luowowo.common.util.DateUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;

@Getter
@Setter
@ToString
public class FlightScheduled implements Serializable{

    private Long id; //Id

    private String airline_name; //航空公司名

    private String plane_name; //飞机名字

    private String flight_no; //航班号

    private String dep_time; //起飞的时间

    private String arr_time; //到达的时间

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date dep_date_time; //起飞的日期时间

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date arr_date_time; //到达的日期时间

    private String org_airport; //出发城市code

    private FlightCity org_city;//出发城市

    private String dst_airport; //到达城市code

    private FlightCity dst_city;//到达城市

    private String org_airport_name; //起飞机场名字

    private String dst_airport_name; //到达机场名字

    private String fly_time; //飞行用时

    private Long price;//价钱

    private int price_num;//经济舱价钱

    private Long businessVotePrice;//公务舱价钱

    private int businessVote_num;//公务舱剩余票数

    private int airportTaxAudlet; // 燃油机税 固定50

    private String org_airport_terminal;//起飞航站楼

    private String dst_airport_terminal;//落地航站楼


    public String getWeek(){
        String[] weeks = {"日","一","二","三","四","五","六"};
        Calendar cal = Calendar.getInstance();
        cal.setTime(arr_date_time);
        int week_index = cal.get(Calendar.DAY_OF_WEEK) - 1;
        if(week_index<0){
            week_index = 0;
        }
        return weeks[week_index];
    }
}